//
//  YJKeychainTool.m
//  YJB
//
//  Created by YJB on 16/8/23.
//  Copyright © 2016年 YJB. All rights reserved.
//

#import "YJKeychainTool.h"
//这个框架用pod导入的时候要这么来导入
#import <SAMKeychain/SAMKeychain.h>

@implementation YJKeychainTool
+ (void)saveUserName:(NSString *)userName
{
    if (![SAMKeychain setPassword:userName forService:@"com.yjb.zddw" account:@"userName"])
    {
        [SAMKeychain setPassword:userName forService:@"com.yjb.zddw" account:@"userName"];
    }
}

+ (NSString *)readUserName
{
     return [SAMKeychain passwordForService:@"com.yjb.zddw" account:@"userName"];
}

+ (void)saveUserAccount:(NSString *)account
{
    if (![SAMKeychain setPassword:account forService:@"com.yjb.zddw" account:@"account"])
    {
        [SAMKeychain setPassword:account forService:@"com.yjb.zddw" account:@"account"];
    }
}

+ (NSString *)readUserAccount
{
    return [SAMKeychain passwordForService:@"com.yjb.zddw" account:@"account"];
}

+ (void)savePassword:(NSString *)passWord
{

    if (![SAMKeychain setPassword:passWord forService:@"com.yjb.zddw" account:@"passWord"])
    {
        [SAMKeychain setPassword:passWord forService:@"com.yjb.zddw" account:@"passWord"];
    }
}

+ (NSString *)readPassword
{
    return [SAMKeychain passwordForService:@"com.yjb.zddw" account:@"passWord"];
}

@end
